package com.views;

import java.awt.Color;
import java.awt.Font;

import javax.swing.JButton;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

public class CreateUserView extends JInternalFrame {

	JPanel panel;

	JLabel lblMessages;

	JLabel lblUserNameError, lblPasswordError, lblQuestionError,
			lblAnswerError;

	JLabel lblCreateUserLabel, lblUserName, lblPassword, lblQuestion,
			lblAnswer;

	JTextField txtUserName, txtQuestion, txtAnswer;

	JPasswordField txtPassword;

	JButton btnSubmit, btnReset;

	public JLabel getLblUserNameError() {
		return lblUserNameError;
	}

	public JLabel getLblPasswordError() {
		return lblPasswordError;
	}

	public JLabel getLblQuestionError() {
		return lblQuestionError;
	}

	public JLabel getLblAnswerError() {
		return lblAnswerError;
	}

	public JLabel getLblMessages() {
		return lblMessages;
	}

	public JTextField getTxtUserName() {
		return txtUserName;
	}

	public JPasswordField getTxtPassword() {
		return txtPassword;
	}

	public JTextField getTxtQuestion() {
		return txtQuestion;
	}

	public JTextField getTxtAnswer() {
		return txtAnswer;
	}

	public JButton getBtnSubmit() {
		return btnSubmit;
	}

	public JButton getBtnReset() {
		return btnReset;
	}

	public CreateUserView() {

		super("Create User Frame", true, true, true, true);
		setLayout(null);

		panel = new JPanel();
		panel.setBounds(0, 0, 500, 500);
		panel.setLayout(null);
		panel.setBackground(Color.black);

		Font createUserFrameFont = new Font("Verdana", Font.BOLD, 15);

		lblCreateUserLabel = new JLabel("Fill the form to get registered");
		lblCreateUserLabel.setForeground(Color.RED);
		lblCreateUserLabel.setFont(createUserFrameFont);
		lblMessages = new JLabel(" ");
		lblMessages.setFont(createUserFrameFont);
		lblMessages.setForeground(Color.red);
		lblUserNameError = new JLabel("*");
		lblUserNameError.setForeground(Color.red);
		lblUserNameError.setFont(createUserFrameFont);
		lblUserName = new JLabel("Username");
		lblPasswordError = new JLabel("*");
		lblPasswordError.setForeground(Color.red);
		lblPasswordError.setFont(createUserFrameFont);
		lblQuestionError = new JLabel("*");
		lblQuestionError.setForeground(Color.red);
		lblQuestionError.setFont(createUserFrameFont);
		lblAnswerError = new JLabel("*");
		lblAnswerError.setForeground(Color.red);
		lblAnswerError.setFont(createUserFrameFont);
		lblUserName.setFont(createUserFrameFont);
		lblUserName.setForeground(Color.white);
		lblPassword = new JLabel("Password");
		lblPassword.setFont(createUserFrameFont);
		lblPassword.setForeground(Color.white);
		lblQuestion = new JLabel("Question");
		lblQuestion.setFont(createUserFrameFont);
		lblQuestion.setForeground(Color.white);
		lblAnswer = new JLabel("Answer");
		lblAnswer.setFont(createUserFrameFont);
		lblAnswer.setForeground(Color.white);

		txtUserName = new JTextField();
		txtPassword = new JPasswordField();

		txtQuestion = new JTextField();
		txtAnswer = new JTextField();

		btnSubmit = new JButton("Submit");
		btnSubmit.setFont(createUserFrameFont);
		btnReset = new JButton("Reset");

		btnReset.setFont(createUserFrameFont);

		lblCreateUserLabel.setBounds(100, 30, 300, 50);
		lblMessages.setBounds(50, 350, 400, 50);
		lblMessages.setVisible(false);

		lblUserName.setBounds(50, 100, 150, 30);
		lblUserNameError.setBounds(180, 100, 20, 20);
		lblUserNameError.setVisible(false);
		lblPassword.setBounds(50, 150, 150, 30);
		lblPasswordError.setBounds(180, 150, 20, 20);
		lblPasswordError.setVisible(false);
		lblQuestion.setBounds(50, 200, 150, 30);
		lblQuestionError.setBounds(180, 200, 20, 20);
		lblQuestionError.setVisible(false);
		lblAnswer.setBounds(50, 250, 150, 30);
		lblAnswerError.setBounds(180, 250, 20, 20);
		lblAnswerError.setVisible(false);

		txtUserName.setBounds(200, 100, 150, 30);
		txtPassword.setBounds(200, 150, 150, 30);
		txtQuestion.setBounds(200, 200, 150, 30);
		txtAnswer.setBounds(200, 250, 150, 30);

		btnSubmit.setBounds(200, 300, 95, 40);
		btnReset.setBounds(300, 300, 90, 40);

		panel.add(lblCreateUserLabel);
		panel.add(lblMessages);
		panel.add(lblUserNameError);
		panel.add(lblPasswordError);
		panel.add(lblQuestionError);
		panel.add(lblAnswerError);
		panel.add(lblUserName);
		panel.add(lblPassword);
		panel.add(lblQuestion);
		panel.add(lblAnswer);
		panel.add(txtUserName);
		panel.add(txtPassword);
		panel.add(txtQuestion);
		panel.add(txtAnswer);
		panel.add(btnSubmit);
		panel.add(btnReset);

		add(panel);

		setVisible(true);
		setSize(500, 500);

	}
}
